cmake_minimum_required(VERSION 2.8)
project(jf_img_diag)

add_compile_options(-std=c++11)
add_compile_options(-pthread)

find_package(OpenCV)
file(GLOB_RECURSE files_src src/*.cpp)
file(GLOB_RECURSE files_include include/*.h)

include_directories(
    include  
)

message("jf_img_diaggggggggggggggggggggg")

option(USE_ROS "use ros"  ON)
if(USE_ROS)
    find_package(catkin REQUIRED COMPONENTS roscpp)
    catkin_package(
        INCLUDE_DIRS include
        LIBRARIES jf_img_diag
    )
    include_directories(
        ${catkin_INCLUDE_DIRS}
    )
endif()

add_library(${PROJECT_NAME} SHARED
    ${files_src}
    ${files_include}
)

# 指定动态库版本
# VERSION 动态库版本
# SOVERSION API版本
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 0.0.0 SOVERSION 0)

target_link_libraries(${PROJECT_NAME}
    ${OpenCV_LIBS}
)

# install
if(USE_ROS)
else()
	install(TARGETS ${PROJECT_NAME}
        DESTINATION lib)
    install(DIRECTORY include/
        DESTINATION include)
endif()